Skip to content

Conversation

tim-vandecasteele
Copy link

disclaimer: I'm a bit puzzled by this problem, as everyone should have this problem but then people would have a lot of problems with websockets

Context: I'm using websockets over https, using WiFiClientSecure

Using WebSocketClient::begin I got into problems where status = responseStatusCode(); would be trying to read the HTTP header, but because both HttpClient and WebSocketClient have a read function, the read from WebSocketClient was used, which returns a bunch of gibberish bytes. This caused the WebSocket to think that the connection was not successfully upgraded, whereas in reality the webserver gave a proper response.

websocketClient = new WebSocketClient(wifiWebsocket, "www.host.com", 443);
int ret = websocketClient->begin(websocketPath);

this basically gave ret = -4, because responseStatusCode couldn't find the HTTP header.

Let me know what the structure is to get things merged, or what adaptations are required.

(I tested this on a simple esp32 board)

Using WebSocketClient::begin I got into problems where `status = responseStatusCode();` would be trying to read the HTTP header, but because both HttpClient and WebSocketClient have a read function, the read from WebSocketClient was used, which returns a bunch of gibberish. This caused the WebSocket to think that the connection was not successfully upgraded.
@CLAassistant
Copy link

CLAassistant commented Apr 9, 2023

CLA assistant check
All committers have signed the CLA.

@github-actions
Copy link

github-actions bot commented Apr 9, 2023

Memory usage change @ 8566fb4

Board flash % RAM for global variables %
arduino:samd:mkr1000 💚 -8 - 0 -0.0 - 0.0 0 - 0 0.0 - 0.0
Click for full report table
Board examples/BasicAuthGet
flash
% examples/BasicAuthGet
RAM for global variables
% examples/CustomHeader
flash
% examples/CustomHeader
RAM for global variables
% examples/DweetGet
flash
% examples/DweetGet
RAM for global variables
% examples/DweetPost
flash
% examples/DweetPost
RAM for global variables
% examples/HueBlink
flash
% examples/HueBlink
RAM for global variables
% examples/PostWithHeaders
flash
% examples/PostWithHeaders
RAM for global variables
% examples/SimpleDelete
flash
% examples/SimpleDelete
RAM for global variables
% examples/SimpleGet
flash
% examples/SimpleGet
RAM for global variables
% examples/SimpleHttpExample
flash
% examples/SimpleHttpExample
RAM for global variables
% examples/SimplePost
flash
% examples/SimplePost
RAM for global variables
% examples/SimplePut
flash
% examples/SimplePut
RAM for global variables
% examples/SimpleWebSocket
flash
% examples/SimpleWebSocket
RAM for global variables
%
arduino:samd:mkr1000 0 0.0 0 0.0 0 0.0 0 0.0 -8 -0.0 0 0.0 0 0.0 0 0.0 -8 -0.0 0 0.0 0 0.0 0 0.0 -8 -0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0 0 0.0
Click for full report CSV
Board,examples/BasicAuthGet<br>flash,%,examples/BasicAuthGet<br>RAM for global variables,%,examples/CustomHeader<br>flash,%,examples/CustomHeader<br>RAM for global variables,%,examples/DweetGet<br>flash,%,examples/DweetGet<br>RAM for global variables,%,examples/DweetPost<br>flash,%,examples/DweetPost<br>RAM for global variables,%,examples/HueBlink<br>flash,%,examples/HueBlink<br>RAM for global variables,%,examples/PostWithHeaders<br>flash,%,examples/PostWithHeaders<br>RAM for global variables,%,examples/SimpleDelete<br>flash,%,examples/SimpleDelete<br>RAM for global variables,%,examples/SimpleGet<br>flash,%,examples/SimpleGet<br>RAM for global variables,%,examples/SimpleHttpExample<br>flash,%,examples/SimpleHttpExample<br>RAM for global variables,%,examples/SimplePost<br>flash,%,examples/SimplePost<br>RAM for global variables,%,examples/SimplePut<br>flash,%,examples/SimplePut<br>RAM for global variables,%,examples/SimpleWebSocket<br>flash,%,examples/SimpleWebSocket<br>RAM for global variables,%
arduino:samd:mkr1000,0,0.0,0,0.0,0,0.0,0,0.0,-8,-0.0,0,0.0,0,0.0,0,0.0,-8,-0.0,0,0.0,0,0.0,0,0.0,-8,-0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0

@tim-vandecasteele
Copy link
Author

Hi @per1234 are you still maintaining this project?
If so, let me know if there's anything else required, if not, do you prefer that people fork this, or is there a process to find a new maintainer?

@per1234 per1234 added type: imperfection Perceived defect in any part of project topic: code Related to content of the project itself labels Apr 12, 2023
@per1234
Copy link

per1234 commented Apr 12, 2023

Hi @tim-vandecasteele. Thanks for your pull request!

My role in this project is janitorial. I try to help keep the issue tracker tidy and maintain the infrastructure, but am not in a role to decide on changes to the codebase.

One of the other maintainers will need to take care of the review and merging of this pull request.

@tim-vandecasteele
Copy link
Author

Hi, sorry, I was too quick drawing conclusions from the dependabot merges. Any idea who would be a maintainer for this project then? Looking through the commits there weren't a lot of merges other than these updates in this project.

Sorry to bring these questions to you, not really clear who else should be addressed 😅

@andreagilardoni andreagilardoni self-requested a review March 21, 2024 16:07
@andreagilardoni
Copy link

andreagilardoni commented Mar 21, 2024

Hi @tim-vandecasteele, I would also add HttpClient:: on this line

write(aBody, aContentLength);
As far as I am aware I cannot suggest a change on that line. I don't see these changes harmful for the repository, I will try them and merge this PR. Thanks for your work!

@andreagilardoni andreagilardoni merged commit 0ec8824 into arduino-libraries:master Mar 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants